
/* 竞赛网格样式 */
.competitions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 40px;
  /* 确保正确的渲染上下文 */
  position: relative;
  z-index: 1;
}

.contest-card {
  background: #FFFFFF;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: all 0.3s ease;
  position: relative;
  border: 1px solid #E5E7EB;
  cursor: pointer;
  /* 确保正确的渲染上下文 */
  z-index: 1;
  transform-style: preserve-3d;
  display: flex;
  flex-direction: column;
}

.contest-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* 统一的评级标签样式 - 支持正六边形和圆形两种设计 */
.card-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 56px;
  height: 56px;
  font-size: 18px;
  font-weight: 800;
  z-index: 1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  /* 正六边形形状 */
  clip-path: polygon(50% 0%, 93.3% 25%, 93.3% 75%, 50% 100%, 6.7% 75%, 6.7% 25%);
  transform: rotate(0deg);
  transition: all 0.3s ease;
  /* 确保在3D空间中正确渲染 */
  transform-style: preserve-3d;
  will-change: transform;
  /* 内部布局 */
  flex-direction: column;
  gap: 2px;
}

.card-badge:hover {
  transform: scale(1.05) rotate(0deg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 6px 16px rgba(0, 0, 0, 0.4);
}

.card-badge iconify-icon {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.card-badge .rating-text {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  margin-top: -2px;
}

/* A级 - 金色系 */
.card-badge.A {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.95), rgba(255, 165, 0, 0.95), rgba(255, 215, 0, 0.85));
  color: #000;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 215, 0, 0.8);
}

.card-badge.Aminus {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.9), rgba(255, 165, 0, 0.9), rgba(255, 215, 0, 0.8));
  color: #000;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 215, 0, 0.7);
}

/* B级 - 紫色系 */
.card-badge.B {
  background: linear-gradient(135deg, rgba(155, 89, 182, 0.95), rgba(142, 68, 173, 0.95), rgba(155, 89, 182, 0.85));
  color: #FFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  border-color: rgba(155, 89, 182, 0.8);
}

.card-badge.Bminus {
  background: linear-gradient(135deg, rgba(155, 89, 182, 0.9), rgba(142, 68, 173, 0.9), rgba(155, 89, 182, 0.8));
  color: #FFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  border-color: rgba(155, 89, 182, 0.7);
}

/* C级 - 蓝色系 */
.card-badge.C {
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.95), rgba(41, 128, 185, 0.95), rgba(52, 152, 219, 0.85));
  color: #FFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  border-color: rgba(52, 152, 219, 0.8);
}

.card-badge.Cminus {
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.9), rgba(41, 128, 185, 0.9), rgba(52, 152, 219, 0.8));
  color: #FFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  border-color: rgba(52, 152, 219, 0.7);
}

/* D级 - 灰色系 */
.card-badge.D {
  background: linear-gradient(135deg, rgba(149, 165, 166, 0.95), rgba(127, 140, 141, 0.95), rgba(149, 165, 166, 0.85));
  color: #FFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  border-color: rgba(149, 165, 166, 0.8);
}

.card-badge.Dminus {
  background: linear-gradient(135deg, rgba(149, 165, 166, 0.9), rgba(127, 140, 141, 0.9), rgba(149, 165, 166, 0.8));
  color: #FFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  border-color: rgba(149, 165, 166, 0.7);
}

/* 圆形样式的评级标签（用于详细信息页面和缩小版卡片） */
.card-badge.circular,
.detail-page .card-badge {
  width: 40px;
  height: 40px;
  font-size: 14px;
  top: 8px;
  right: 8px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  border: none;
  clip-path: none;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.6), 0 0 20px rgba(239, 68, 68, 0.4);
}

.card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.card-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #1F2937;
  line-height: 1.4;
}

.card-description {
  font-size: 14px;
  color: #6B7280;
  margin-bottom: 12px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}

.card-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.card-organizer {
  font-size: 13px;
  color: #6B7280;
  text-align: right;
  line-height: 1.4;
  max-width: 40%;
  word-wrap: break-word;
  white-space: normal;
}

.category-tag {
  background: linear-gradient(135deg, #3B82F6, #1D4ED8);
  color: white;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
  transition: all 0.2s ease;
}

.category-tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.card-subtitle {
  font-size: 14px;
  color: #6B7280;
  margin-bottom: 12px;
  line-height: 1.5;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  color: #9CA3AF;
  font-size: 13px;
  font-weight: 500;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #F3F4F6;
}

.comp-rating-A-plus {
  background: #9333ea;
  color: white;
  box-shadow: 0 0 8px rgba(147, 51, 234, 0.6), 0 0 16px rgba(147, 51, 234, 0.4);
}

.comp-rating-A {
  background: #dc2626;
  color: white;
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.6), 0 0 16px rgba(220, 38, 38, 0.4);
}

.comp-rating-B-plus {
  background: #16a34a;
  color: white;
  box-shadow: 0 0 8px rgba(22, 163, 74, 0.6), 0 0 16px rgba(22, 163, 74, 0.4);
}

.comp-rating-B {
  background: #2563eb;
  color: white;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.6), 0 0 16px rgba(37, 99, 235, 0.4);
}

.comp-rating-C {
  background: #6b7280;
  color: white;
  box-shadow: 0 0 8px rgba(107, 114, 128, 0.6), 0 0 16px rgba(107, 114, 128, 0.4);
}

/* 详细信息中的评级标签样式 */
.detail-badge {
    display: inline-flex;
    position: relative;
    width: 40px;
    height: 40px;
    font-size: 14px;
    font-weight: 800;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.6);
    align-items: center;
    justify-content: center;
    text-align: center;
    /* 正六边形形状 */
    clip-path: polygon(50% 0%, 93.3% 25%, 93.3% 75%, 50% 100%, 6.7% 75%, 6.7% 25%);
    transform: rotate(0deg);
    transition: all 0.3s ease;
    /* 确保在3D空间中正确渲染 */
    transform-style: preserve-3d;
    will-change: transform;
    /* 内部布局 */
    flex-direction: column;
    gap: 2px;
    background: #ef4444;
    color: white;
}

.detail-badge:hover {
    transform: scale(1.05) rotate(0deg);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 6px 16px rgba(0, 0, 0, 0.4);
}

.detail-badge iconify-icon {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.detail-badge .rating-text {
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    margin-top: -2px;
}

/* 详细信息中的A级 - 金色系 */
.detail-badge.A,
.detail-badge.Aminus {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.95), rgba(255, 165, 0, 0.95), rgba(255, 215, 0, 0.85));
    color: #000;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 215, 0, 0.8);
}

/* 详细信息中的B级 - 紫色系 */
.detail-badge.B,
.detail-badge.Bminus {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.95), rgba(142, 68, 173, 0.95), rgba(155, 89, 182, 0.85));
    color: #FFF;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    border-color: rgba(155, 89, 182, 0.8);
}

/* 详细信息中的C级 - 蓝色系 */
.detail-badge.C,
.detail-badge.Cminus {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.95), rgba(41, 128, 185, 0.95), rgba(52, 152, 219, 0.85));
    color: #FFF;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    border-color: rgba(52, 152, 219, 0.8);
}

/* 详细信息中的D级 - 灰色系 */
.detail-badge.D,
.detail-badge.Dminus {
    background: linear-gradient(135deg, rgba(149, 165, 166, 0.95), rgba(127, 140, 141, 0.95), rgba(149, 165, 166, 0.85));
    color: #FFF;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    border-color: rgba(149, 165, 166, 0.8);
}

/* 未知评级样式（灰色正六边形，文本为 ?） */
.card-badge.unknown {
  background: linear-gradient(135deg, rgba(149, 165, 166, 0.95), rgba(127, 140, 141, 0.95), rgba(149, 165, 166, 0.85));
  color: #FFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  border-color: rgba(149, 165, 166, 0.8);
}

.detail-badge.unknown {
  background: linear-gradient(135deg, rgba(149, 165, 166, 0.95), rgba(127, 140, 141, 0.95), rgba(149, 165, 166, 0.85));
  color: #FFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  border-color: rgba(149, 165, 166, 0.8);
}

/* 分类标签 */
.comp-category {
  @apply px-3 py-1 bg-gray-100 dark:bg-gray-700 rounded-full text-sm;
}

/* 信息标签 */
.comp-info {
  @apply px-3 py-1 bg-gray-100 dark:bg-gray-700 rounded-full text-sm;
}

/* 卡片基础样式 */
.comp-card {
  @apply bg-white dark:bg-gray-800 p-6 rounded-lg shadow hover:shadow-lg transition-shadow;
}

/* 加载状态 */
.comp-loading {
  @apply text-center py-12;
}

.comp-loading-spinner {
  @apply animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-blue-500 mx-auto;
}

.comp-loading-text {
  @apply mt-4 text-gray-600 dark:text-gray-400;
}

/* 错误状态 */
.comp-error {
  @apply bg-red-50 border border-red-200 rounded p-4;
}

.comp-error-title {
  @apply text-red-600 font-medium;
}

.comp-error-message {
  @apply text-red-500 text-sm mt-1;
}

.comp-retry-btn {
  @apply mt-2 px-3 py-1 bg-red-100 text-red-700 rounded text-sm;
}


/* 竞赛卡片容器 - 响应式网格布局 */
#competitions-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 16px;
}

/* 缩小版竞赛卡片 */
.contest-card {
    position: relative;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    height: 100%; /* 确保卡片高度统一 */
}

/* 卡片悬停效果 */
.contest-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.card-image {
    height: 200px;
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.card-content {
    padding: 12px;
}

.card-title {
    font-size: 16px;
    margin-bottom: 6px;
}

.card-subtitle {
    font-size: 13px;
    margin-bottom: 8px;
    -webkit-line-clamp: 2; /* 限制两行 */
}

.card-footer {
    font-size: 12px;
    padding-top: 8px;
}

/* 响应式调整 */
@media (max-width: 640px) {
    #competitions-container {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }

    .card-image {
        height: 150px;
    }
    
    .card-info-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .card-organizer {
        max-width: 100%;
        text-align: left;
        font-size: 12px;
    }
    
    .card-categories {
        margin-bottom: 0;
    }
}

/* 模态框样式 */
.competition-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3), 0 10px 25px rgba(0, 0, 0, 0.2);
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    animation: modalSlideIn 0.4s ease-out;
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.modal-header {
    padding: 28px 24px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #F8FAFC, #F1F5F9, #E2E8F0);
    border-radius: 20px 20px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1F2937;
    flex: 1;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6B7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #E5E7EB;
    color: #374151;
}

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
}

/* 自定义滚动条样式 */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Firefox滚动条样式 */
.modal-body {
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

.info-row {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.info-label {
    font-weight: 600;
    color: #374151;
    min-width: 80px;
}

.info-value {
    color: #6B7280;
    flex: 1;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-badge.ongoing {
    background: #DEF7EC;
    color: #03543F;
}

.status-badge.upcoming {
    background: #FEF3C7;
    color: #92400E;
}

.status-badge.finished {
    background: #FEE2E2;
    color: #DC2626;
}

.description-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #E5E7EB;
}

.description-section h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
}

.description-section p {
    margin: 0;
    line-height: 1.8;
    color: #4B5563;
    font-size: 14px;
    background: #F9FAFB;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid #2A5CAA;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 300px;
    overflow-y: auto;
}

.description-section p::-webkit-scrollbar {
    width: 6px;
}

.description-section p::-webkit-scrollbar-track {
    background: #F1F5F9;
    border-radius: 3px;
}

.description-section p::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 3px;
}

.description-section p::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

.modal-actions {
    padding: 24px;
    border-top: 1px solid #E5E7EB;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-shrink: 0;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
    white-space: nowrap;
    min-width: 100px;
}

.btn-primary {
    background: #2A5CAA;
    color: white;
}

.btn-primary:hover {
    background: #1e4788;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #F3F4F6;
    color: #6B7280;
    border: 1px solid #E5E7EB;
}

.btn-secondary:hover {
    background: #E5E7EB;
    color: #374151;
}

/* 关闭按钮文字居中 */
.modal-close-btn {
    justify-content: center !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
}

/* 复制提示样式 */
.copy-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 300px;
}

.copy-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.copy-toast.success {
    border-left: 4px solid #10B981;
    color: #065F46;
}

.copy-toast.success iconify-icon {
    color: #10B981;
}

.copy-toast.error {
    border-left: 4px solid #EF4444;
    color: #991B1B;
}

.copy-toast.error iconify-icon {
    color: #EF4444;
}

/* 搜索高亮样式 */
.search-highlight {
    background: #FEF3C7;
    color: #92400E;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}



/* 响应式设计 */
@media (max-width: 768px) {
    .competitions-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .contest-card {
        border-radius: 8px;
    }
    
    .card-content {
        padding: 16px;
    }
    
    .card-title {
        font-size: 16px;
    }
    
    .card-description {
        font-size: 13px;
    }
    
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 20px 16px;
    }
    
    .modal-body {
        padding: 16px;
        max-height: 55vh;
    }
    
    .modal-actions {
        padding: 16px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 13px;
        min-width: 80px;
    }
    
    .modal-close-btn {
        justify-content: center;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .competitions-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .contest-card {
        border-radius: 6px;
    }
    
    .card-content {
        padding: 12px;
    }
    
    .card-title {
        font-size: 15px;
    }
    
    .card-description {
        font-size: 12px;
    }
    
    .modal-content {
        width: 98%;
        max-height: 95vh;
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 16px 12px;
        border-radius: 12px 12px 0 0;
    }
    
    .modal-header h2 {
        font-size: 18px;
    }
    
    .modal-body {
        padding: 12px;
        max-height: 50vh;
    }
    
    .modal-actions {
        padding: 12px;
        flex-direction: column;
        gap: 8px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 14px;
        width: 100%;
        justify-content: center;
    }
    
    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        margin-bottom: 12px;
    }
    
    .info-label {
        min-width: auto;
        font-size: 13px;
    }
    
    .info-value {
        font-size: 13px;
    }
}

@media (max-width: 360px) {
    .modal-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: none;
    }
    
    .modal-header {
        border-radius: 0;
    }
    
    .modal-body {
        max-height: 45vh;
    }
    
    .modal-actions {
        padding: 16px 12px;
    }
    
    .btn {
        padding: 12px 16px;
        font-size: 15px;
    }
    
    .modal-close-btn {
        justify-content: center;
        text-align: center;
    }
}